﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using LibHuman;
namespace Human
{
	public class frmDanhSachCBCNVDeNghiNangLuong_quy : System.Windows.Forms.Form
    {
        #region Danh sach cb_cnv de nghi nang luong
        private DataSet ds =new DataSet();
        string tungay = "", denngay = "", ngay = "", ReportName = "",s_bophan="",user_dn="", 
            msg = "DANH SÁCH CB - CNV ĐỀ NGHỊ NÂNG LƯƠNG", title = "", s_mmyy = "",user="";
        AccessData mDb = new AccessData();
        DataSet ds_nhomn = new DataSet();
        string s_manhom = "", s_tennhom = "";
        Language lan = new Language();
        private bool admin = false;
		DataTable dt_thang = new DataTable();
		DataTable dt_nam = new DataTable();
        DataTable dt_ngach = new DataTable();
        private CheckBox checkxem;
        private Button btnketthuc;
        private Button btnchon;
        private Label label4;
        private Label label3;
        private ComboBox cmbhoten;
        private TextBox txttongso;
        private TextBox txtmanv;
        private GroupBox groupBox1;
        private DataGridView dgvDanhSach;
        private CheckBox checkupdate;
        private CheckBox checkin;
        private CheckBox chk_uphd;
        private haison haison1;
        private Label lbl_nhom;
        private CheckedListBox chkl_nhomngach;
        private TextBox txt_tieude;
        private Label label2;
        private ComboBox cbo_nhom;
        private DataGridViewTextBoxColumn Colstt;
        private DataGridViewTextBoxColumn Colhoten;
        private DataGridViewTextBoxColumn Colbophan;
        private DataGridViewTextBoxColumn Coltenvt;
        private DataGridViewTextBoxColumn Colloanngach;
        private DataGridViewTextBoxColumn Colmangach;
        private DataGridViewTextBoxColumn Colb_dau;
        private DataGridViewTextBoxColumn Colhs_lc;
        private DataGridViewTextBoxColumn Colvk;
        private DataGridViewTextBoxColumn Colngayxep;
        private DataGridViewTextBoxColumn Colbac;
        private DataGridViewTextBoxColumn Colhs_moi;
        private DataGridViewTextBoxColumn Colngay;
        private DataGridViewTextBoxColumn Colmadv;
        private DataGridViewTextBoxColumn ngaysinh;
        private DataGridViewTextBoxColumn nam_ngaysinh;
        private DataGridViewTextBoxColumn td_chuyenmon;
        private DataGridViewTextBoxColumn manv;
        private DataGridViewTextBoxColumn luong_hd;
        private DataGridViewTextBoxColumn tennhom;
        private DataGridViewTextBoxColumn nhomngach;
		private System.ComponentModel.Container components = null;
        #endregion

        public frmDanhSachCBCNVDeNghiNangLuong_quy(bool m_admin,string s_makp,string s_userdn)
		{
			InitializeComponent();
            lan.Read_Language_to_Xml(this.Name.ToString(), this);
            lan.Changelanguage_to_English(this.Name.ToString(), this);
            admin = m_admin;
            s_bophan = s_makp;
            user_dn = s_userdn;
		}
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
            this.checkxem = new System.Windows.Forms.CheckBox();
            this.btnketthuc = new System.Windows.Forms.Button();
            this.btnchon = new System.Windows.Forms.Button();
            this.label4 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.cmbhoten = new System.Windows.Forms.ComboBox();
            this.txttongso = new System.Windows.Forms.TextBox();
            this.txtmanv = new System.Windows.Forms.TextBox();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.dgvDanhSach = new System.Windows.Forms.DataGridView();
            this.checkupdate = new System.Windows.Forms.CheckBox();
            this.checkin = new System.Windows.Forms.CheckBox();
            this.chk_uphd = new System.Windows.Forms.CheckBox();
            this.lbl_nhom = new System.Windows.Forms.Label();
            this.chkl_nhomngach = new System.Windows.Forms.CheckedListBox();
            this.txt_tieude = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.cbo_nhom = new System.Windows.Forms.ComboBox();
            this.haison1 = new Human.haison();
            this.Colstt = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colhoten = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colbophan = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Coltenvt = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colloanngach = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colmangach = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colb_dau = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colhs_lc = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colvk = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colngayxep = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colbac = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colhs_moi = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colngay = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.Colmadv = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.ngaysinh = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.nam_ngaysinh = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.td_chuyenmon = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.manv = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.luong_hd = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.tennhom = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.nhomngach = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.groupBox1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dgvDanhSach)).BeginInit();
            this.SuspendLayout();
            // 
            // checkxem
            // 
            this.checkxem.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.checkxem.Checked = true;
            this.checkxem.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkxem.Location = new System.Drawing.Point(425, 527);
            this.checkxem.Name = "checkxem";
            this.checkxem.Size = new System.Drawing.Size(85, 17);
            this.checkxem.TabIndex = 17;
            this.checkxem.Text = "Xem trang in";
            this.checkxem.UseVisualStyleBackColor = true;
            this.checkxem.CheckedChanged += new System.EventHandler(this.checkxem_CheckedChanged);
            this.checkxem.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cmbquy_KeyDown);
            // 
            // btnketthuc
            // 
            this.btnketthuc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.btnketthuc.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.btnketthuc.Image = global::Human.Properties.Resources.close_r;
            this.btnketthuc.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.btnketthuc.Location = new System.Drawing.Point(630, 528);
            this.btnketthuc.Name = "btnketthuc";
            this.btnketthuc.Size = new System.Drawing.Size(65, 28);
            this.btnketthuc.TabIndex = 19;
            this.btnketthuc.Text = "&Thoát";
            this.btnketthuc.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.btnketthuc.UseVisualStyleBackColor = true;
            this.btnketthuc.Click += new System.EventHandler(this.btnketthuc_Click);
            this.btnketthuc.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cmbquy_KeyDown);
            // 
            // btnchon
            // 
            this.btnchon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.btnchon.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.btnchon.Image = global::Human.Properties.Resources.ok;
            this.btnchon.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.btnchon.Location = new System.Drawing.Point(559, 528);
            this.btnchon.Name = "btnchon";
            this.btnchon.Size = new System.Drawing.Size(65, 28);
            this.btnchon.TabIndex = 18;
            this.btnchon.Text = "  &Chọn";
            this.btnchon.UseVisualStyleBackColor = true;
            this.btnchon.Click += new System.EventHandler(this.btnchon_Click);
            this.btnchon.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cmbquy_KeyDown);
            // 
            // label4
            // 
            this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.label4.Location = new System.Drawing.Point(71, 528);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(58, 13);
            this.label4.TabIndex = 21;
            this.label4.Text = "Họ và Tên";
            this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // label3
            // 
            this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.label3.Location = new System.Drawing.Point(5, 528);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(40, 13);
            this.label3.TabIndex = 20;
            this.label3.Text = "Mã NV";
            this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            // 
            // cmbhoten
            // 
            this.cmbhoten.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.cmbhoten.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cmbhoten.FormattingEnabled = true;
            this.cmbhoten.Location = new System.Drawing.Point(74, 544);
            this.cmbhoten.Name = "cmbhoten";
            this.cmbhoten.Size = new System.Drawing.Size(218, 21);
            this.cmbhoten.TabIndex = 16;
            this.cmbhoten.SelectedIndexChanged += new System.EventHandler(this.cmbhoten_SelectedIndexChanged);
            this.cmbhoten.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cmbquy_KeyDown);
            // 
            // txttongso
            // 
            this.txttongso.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.txttongso.BackColor = System.Drawing.SystemColors.Control;
            this.txttongso.Location = new System.Drawing.Point(726, 531);
            this.txttongso.Name = "txttongso";
            this.txttongso.ReadOnly = true;
            this.txttongso.Size = new System.Drawing.Size(60, 20);
            this.txttongso.TabIndex = 26;
            this.txttongso.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            // 
            // txtmanv
            // 
            this.txtmanv.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.txtmanv.Location = new System.Drawing.Point(8, 544);
            this.txtmanv.Name = "txtmanv";
            this.txtmanv.ReadOnly = true;
            this.txtmanv.Size = new System.Drawing.Size(60, 20);
            this.txtmanv.TabIndex = 15;
            this.txtmanv.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            this.txtmanv.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cmbquy_KeyDown);
            // 
            // groupBox1
            // 
            this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.groupBox1.Controls.Add(this.dgvDanhSach);
            this.groupBox1.Location = new System.Drawing.Point(5, 114);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(784, 411);
            this.groupBox1.TabIndex = 24;
            this.groupBox1.TabStop = false;
            // 
            // dgvDanhSach
            // 
            this.dgvDanhSach.AllowUserToAddRows = false;
            this.dgvDanhSach.BackgroundColor = System.Drawing.SystemColors.Window;
            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
            dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
            this.dgvDanhSach.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
            this.dgvDanhSach.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgvDanhSach.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.Colstt,
            this.Colhoten,
            this.Colbophan,
            this.Coltenvt,
            this.Colloanngach,
            this.Colmangach,
            this.Colb_dau,
            this.Colhs_lc,
            this.Colvk,
            this.Colngayxep,
            this.Colbac,
            this.Colhs_moi,
            this.Colngay,
            this.Colmadv,
            this.ngaysinh,
            this.nam_ngaysinh,
            this.td_chuyenmon,
            this.manv,
            this.luong_hd,
            this.tennhom,
            this.nhomngach});
            this.dgvDanhSach.Cursor = System.Windows.Forms.Cursors.Default;
            this.dgvDanhSach.Dock = System.Windows.Forms.DockStyle.Fill;
            this.dgvDanhSach.Location = new System.Drawing.Point(3, 16);
            this.dgvDanhSach.Name = "dgvDanhSach";
            this.dgvDanhSach.ReadOnly = true;
            dataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Control;
            dataGridViewCellStyle15.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
            this.dgvDanhSach.RowHeadersDefaultCellStyle = dataGridViewCellStyle15;
            this.dgvDanhSach.RowHeadersWidth = 20;
            this.dgvDanhSach.Size = new System.Drawing.Size(778, 392);
            this.dgvDanhSach.TabIndex = 0;
            // 
            // checkupdate
            // 
            this.checkupdate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.checkupdate.Location = new System.Drawing.Point(305, 546);
            this.checkupdate.Name = "checkupdate";
            this.checkupdate.Size = new System.Drawing.Size(91, 17);
            this.checkupdate.TabIndex = 17;
            this.checkupdate.Text = "Update tất cả";
            this.checkupdate.UseVisualStyleBackColor = true;
            this.checkupdate.CheckedChanged += new System.EventHandler(this.checkupdate_CheckedChanged);
            this.checkupdate.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cmbquy_KeyDown);
            // 
            // checkin
            // 
            this.checkin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.checkin.Location = new System.Drawing.Point(425, 546);
            this.checkin.Name = "checkin";
            this.checkin.Size = new System.Drawing.Size(35, 17);
            this.checkin.TabIndex = 17;
            this.checkin.Text = "In";
            this.checkin.UseVisualStyleBackColor = true;
            this.checkin.CheckedChanged += new System.EventHandler(this.checkin_CheckedChanged);
            this.checkin.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cmbquy_KeyDown);
            // 
            // chk_uphd
            // 
            this.chk_uphd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.chk_uphd.Location = new System.Drawing.Point(305, 527);
            this.chk_uphd.Name = "chk_uphd";
            this.chk_uphd.Size = new System.Drawing.Size(113, 17);
            this.chk_uphd.TabIndex = 17;
            this.chk_uphd.Text = "Update Hợp Đồng";
            this.chk_uphd.UseVisualStyleBackColor = true;
            this.chk_uphd.CheckedChanged += new System.EventHandler(this.chk_uphd_CheckedChanged);
            this.chk_uphd.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cmbquy_KeyDown);
            // 
            // lbl_nhom
            // 
            this.lbl_nhom.Anchor = System.Windows.Forms.AnchorStyles.Top;
            this.lbl_nhom.Location = new System.Drawing.Point(461, 100);
            this.lbl_nhom.Name = "lbl_nhom";
            this.lbl_nhom.Size = new System.Drawing.Size(38, 13);
            this.lbl_nhom.TabIndex = 34;
            this.lbl_nhom.Text = "Nhóm:";
            this.lbl_nhom.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.lbl_nhom.Visible = false;
            // 
            // chkl_nhomngach
            // 
            this.chkl_nhomngach.Anchor = System.Windows.Forms.AnchorStyles.Top;
            this.chkl_nhomngach.CheckOnClick = true;
            this.chkl_nhomngach.ColumnWidth = 165;
            this.chkl_nhomngach.FormattingEnabled = true;
            this.chkl_nhomngach.Location = new System.Drawing.Point(74, 12);
            this.chkl_nhomngach.MultiColumn = true;
            this.chkl_nhomngach.Name = "chkl_nhomngach";
            this.chkl_nhomngach.Size = new System.Drawing.Size(329, 79);
            this.chkl_nhomngach.TabIndex = 36;
            this.chkl_nhomngach.Validated += new System.EventHandler(this.chkl_nhomngach_Validated);
            // 
            // txt_tieude
            // 
            this.txt_tieude.Anchor = System.Windows.Forms.AnchorStyles.Top;
            this.txt_tieude.Location = new System.Drawing.Point(128, 95);
            this.txt_tieude.Name = "txt_tieude";
            this.txt_tieude.Size = new System.Drawing.Size(275, 20);
            this.txt_tieude.TabIndex = 39;
            // 
            // label2
            // 
            this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top;
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.ForeColor = System.Drawing.Color.DarkBlue;
            this.label2.Location = new System.Drawing.Point(71, 98);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(51, 15);
            this.label2.TabIndex = 38;
            this.label2.Text = "Tiêu đề:";
            this.label2.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            // 
            // cbo_nhom
            // 
            this.cbo_nhom.Anchor = System.Windows.Forms.AnchorStyles.Top;
            this.cbo_nhom.FormattingEnabled = true;
            this.cbo_nhom.Items.AddRange(new object[] {
            "Bệnh viện trung tâm",
            "Y tế dự phòng",
            "Y tế xã phường"});
            this.cbo_nhom.Location = new System.Drawing.Point(505, 95);
            this.cbo_nhom.Name = "cbo_nhom";
            this.cbo_nhom.Size = new System.Drawing.Size(139, 21);
            this.cbo_nhom.TabIndex = 40;
            this.cbo_nhom.Visible = false;
            // 
            // haison1
            // 
            this.haison1.Anchor = System.Windows.Forms.AnchorStyles.Top;
            this.haison1.Location = new System.Drawing.Point(454, 12);
            this.haison1.Name = "haison1";
            this.haison1.Size = new System.Drawing.Size(274, 68);
            this.haison1.TabIndex = 0;
            this.haison1.Validated += new System.EventHandler(this.haison1_Validated);
            this.haison1.MouseEnter += new System.EventHandler(this.haison1_MouseEnter);
            this.haison1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.haison1_KeyDown);
            // 
            // Colstt
            // 
            this.Colstt.DataPropertyName = "stt";
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Colstt.DefaultCellStyle = dataGridViewCellStyle2;
            this.Colstt.HeaderText = "Số TT";
            this.Colstt.Name = "Colstt";
            this.Colstt.ReadOnly = true;
            this.Colstt.Width = 40;
            // 
            // Colhoten
            // 
            this.Colhoten.DataPropertyName = "hoten";
            this.Colhoten.HeaderText = "Họ và Tên";
            this.Colhoten.Name = "Colhoten";
            this.Colhoten.ReadOnly = true;
            this.Colhoten.Width = 180;
            // 
            // Colbophan
            // 
            this.Colbophan.DataPropertyName = "tenbp";
            this.Colbophan.HeaderText = "Bộ phận";
            this.Colbophan.Name = "Colbophan";
            this.Colbophan.ReadOnly = true;
            this.Colbophan.Width = 180;
            // 
            // Coltenvt
            // 
            this.Coltenvt.DataPropertyName = "tenvt";
            this.Coltenvt.HeaderText = "Chuyên môn vt";
            this.Coltenvt.Name = "Coltenvt";
            this.Coltenvt.ReadOnly = true;
            this.Coltenvt.Width = 80;
            // 
            // Colloanngach
            // 
            this.Colloanngach.DataPropertyName = "loaingach";
            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Colloanngach.DefaultCellStyle = dataGridViewCellStyle3;
            this.Colloanngach.HeaderText = "Loại Ngạch";
            this.Colloanngach.Name = "Colloanngach";
            this.Colloanngach.ReadOnly = true;
            this.Colloanngach.Width = 40;
            // 
            // Colmangach
            // 
            this.Colmangach.DataPropertyName = "mangach";
            dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Colmangach.DefaultCellStyle = dataGridViewCellStyle4;
            this.Colmangach.HeaderText = "Mã ngạch";
            this.Colmangach.Name = "Colmangach";
            this.Colmangach.ReadOnly = true;
            this.Colmangach.Width = 60;
            // 
            // Colb_dau
            // 
            this.Colb_dau.DataPropertyName = "b_dau";
            dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Colb_dau.DefaultCellStyle = dataGridViewCellStyle5;
            this.Colb_dau.HeaderText = "Bậc hiện hưởng";
            this.Colb_dau.Name = "Colb_dau";
            this.Colb_dau.ReadOnly = true;
            this.Colb_dau.Width = 40;
            // 
            // Colhs_lc
            // 
            this.Colhs_lc.DataPropertyName = "hs_lc";
            dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle6.Format = "N2";
            this.Colhs_lc.DefaultCellStyle = dataGridViewCellStyle6;
            this.Colhs_lc.HeaderText = "Mức lương";
            this.Colhs_lc.Name = "Colhs_lc";
            this.Colhs_lc.ReadOnly = true;
            this.Colhs_lc.Width = 40;
            // 
            // Colvk
            // 
            this.Colvk.DataPropertyName = "hs_vk";
            dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Colvk.DefaultCellStyle = dataGridViewCellStyle7;
            this.Colvk.HeaderText = "% Vượt khung";
            this.Colvk.Name = "Colvk";
            this.Colvk.ReadOnly = true;
            this.Colvk.Width = 40;
            // 
            // Colngayxep
            // 
            this.Colngayxep.DataPropertyName = "ngaybnngach";
            dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle8.Format = "dd/mm/yyyy";
            this.Colngayxep.DefaultCellStyle = dataGridViewCellStyle8;
            this.Colngayxep.HeaderText = "Ngày hưởng";
            this.Colngayxep.Name = "Colngayxep";
            this.Colngayxep.ReadOnly = true;
            // 
            // Colbac
            // 
            this.Colbac.DataPropertyName = "bac";
            dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Colbac.DefaultCellStyle = dataGridViewCellStyle9;
            this.Colbac.HeaderText = "Bậc đề nghị";
            this.Colbac.Name = "Colbac";
            this.Colbac.ReadOnly = true;
            this.Colbac.Width = 40;
            // 
            // Colhs_moi
            // 
            this.Colhs_moi.DataPropertyName = "hs_lcmoi";
            dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle10.Format = "N2";
            this.Colhs_moi.DefaultCellStyle = dataGridViewCellStyle10;
            this.Colhs_moi.HeaderText = "Mức lương đề nghị";
            this.Colhs_moi.Name = "Colhs_moi";
            this.Colhs_moi.ReadOnly = true;
            this.Colhs_moi.Width = 40;
            // 
            // Colngay
            // 
            this.Colngay.DataPropertyName = "s_ngaynang";
            dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle11.Format = "d";
            dataGridViewCellStyle11.NullValue = null;
            this.Colngay.DefaultCellStyle = dataGridViewCellStyle11;
            this.Colngay.HeaderText = "Ngày nâng";
            this.Colngay.Name = "Colngay";
            this.Colngay.ReadOnly = true;
            this.Colngay.Width = 80;
            // 
            // Colmadv
            // 
            this.Colmadv.DataPropertyName = "madv";
            dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.Colmadv.DefaultCellStyle = dataGridViewCellStyle12;
            this.Colmadv.HeaderText = "Mã DV";
            this.Colmadv.Name = "Colmadv";
            this.Colmadv.ReadOnly = true;
            this.Colmadv.Visible = false;
            // 
            // ngaysinh
            // 
            this.ngaysinh.DataPropertyName = "nu_ngaysinh";
            this.ngaysinh.HeaderText = "Ngày sinh nữ";
            this.ngaysinh.Name = "ngaysinh";
            this.ngaysinh.ReadOnly = true;
            // 
            // nam_ngaysinh
            // 
            this.nam_ngaysinh.DataPropertyName = "nam_ngaysinh";
            this.nam_ngaysinh.HeaderText = "Ngày sinh nam";
            this.nam_ngaysinh.Name = "nam_ngaysinh";
            this.nam_ngaysinh.ReadOnly = true;
            // 
            // td_chuyenmon
            // 
            this.td_chuyenmon.DataPropertyName = "td_chuyenmon";
            this.td_chuyenmon.HeaderText = "Trình độ chuyên môn";
            this.td_chuyenmon.Name = "td_chuyenmon";
            this.td_chuyenmon.ReadOnly = true;
            // 
            // manv
            // 
            this.manv.DataPropertyName = "manv";
            dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.manv.DefaultCellStyle = dataGridViewCellStyle13;
            this.manv.HeaderText = "Mã NV";
            this.manv.Name = "manv";
            this.manv.ReadOnly = true;
            // 
            // luong_hd
            // 
            this.luong_hd.DataPropertyName = "luonghd";
            this.luong_hd.HeaderText = "Lương tối thiểu";
            this.luong_hd.Name = "luong_hd";
            this.luong_hd.ReadOnly = true;
            // 
            // tennhom
            // 
            this.tennhom.DataPropertyName = "tennhom";
            this.tennhom.HeaderText = "Tên nhóm";
            this.tennhom.Name = "tennhom";
            this.tennhom.ReadOnly = true;
            // 
            // nhomngach
            // 
            this.nhomngach.DataPropertyName = "nhomngach";
            dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            this.nhomngach.DefaultCellStyle = dataGridViewCellStyle14;
            this.nhomngach.HeaderText = "Nhóm ngạch";
            this.nhomngach.Name = "nhomngach";
            this.nhomngach.ReadOnly = true;
            // 
            // frmDanhSachCBCNVDeNghiNangLuong_quy
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(788, 569);
            this.ControlBox = false;
            this.Controls.Add(this.cbo_nhom);
            this.Controls.Add(this.txt_tieude);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.chkl_nhomngach);
            this.Controls.Add(this.lbl_nhom);
            this.Controls.Add(this.haison1);
            this.Controls.Add(this.chk_uphd);
            this.Controls.Add(this.checkupdate);
            this.Controls.Add(this.checkin);
            this.Controls.Add(this.checkxem);
            this.Controls.Add(this.btnketthuc);
            this.Controls.Add(this.btnchon);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.cmbhoten);
            this.Controls.Add(this.txttongso);
            this.Controls.Add(this.txtmanv);
            this.Controls.Add(this.groupBox1);
            this.ForeColor = System.Drawing.Color.DarkBlue;
            this.MaximizeBox = false;
            this.Name = "frmDanhSachCBCNVDeNghiNangLuong_quy";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Đề nghị nâng lương";
            this.Load += new System.EventHandler(this.frmDanhSachCBCNVDeNghiNangLuong_quy_Load);
            this.groupBox1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.dgvDanhSach)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		#endregion
        private void frmDanhSachCBCNVDeNghiNangLuong_quy_Load(object sender, EventArgs e)
        {
            user = mDb.user;
            checkupdate.Enabled = admin;
            chk_uphd.Enabled = admin;
            if (mDb.Mabv.Trim() == "209.5.09" || mDb.Mabv.Trim()=="209.5.04" || mDb.Mabv.Trim()=="209.5.06")
            {
                lbl_nhom.Visible = true;
                cbo_nhom.Visible = true;
                cbo_nhom.SelectedIndex = 0;
            }
            load_nhomngach();
            this.WindowState = FormWindowState.Maximized;
        }
        private void load_nhomngach()
        {
            ds_nhomn = mDb.get_nhomngach();
            foreach (DataRow dr in ds_nhomn.Tables[0].Rows)
            {
                chkl_nhomngach.Items.Add(dr["tennhom"].ToString());
            }
        }
		private void butThoat_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}
        private string g_manhom(string str)
        {
            string s = "";
            if (str.Trim().Length > 0)
            {
                string[] s1 = str.Split(',');
                for (int i = 0; i < s1.Length; i++)
                {
                    s = s + "'" + s1[i].ToString().Trim() + "',";
                }
            }
            return s;
        }        
        public DataSet getdata()
        {
            getngay();
            title = lan.Change_language_MessageText(" TỪ NGÀY ") +" "+ tungay +" "+ lan.Change_language_MessageText(" ĐẾN NGÀY ") +" "+ denngay ;
            int stt = 0;
            string dk1="",dk2="",dk3="",dkngach="",sql1="",
            sql = " select 0 as stt,ho||' '||ten as hoten,case when phai<>'Nam' then to_char(a.ngaysinh,'dd/mm/yyyy') else null end as nu_ngaysinh,d.nhomngach,nn.tennhom";
            sql += " ,case when phai='Nam' then to_char(a.ngaysinh,'dd/mm/yyyy') else null end as nam_ngaysinh,case when phai<>'Nam' then a.namsinh else null end as nu_namsinh";
            sql += " ,b.macv,b.madv,tenbp,trim(ct.tenctdt)||' - '||trim(bc.tenbang) as td_chuyenmon,case when phai='Nam' then a.namsinh else null end as nam_namsinh";
            sql += " ,d.loaingach,mangach,bac as b_dau,hs_lc,b.hs_vk*100 as hs_vk,to_char(ngaybnngach,'dd/mm/yyyy') as ngaybnngach,b.lan,to_timestamp('" + denngay + "','dd/MM/yyyy') as denngay,";
            dk1 = " (date_part('year',age(to_timestamp('" + denngay + "','dd/MM/yyyy'),ngaybnngach)) -count(e.manv))/3";
            dk2 = " (date_part('year',age(to_timestamp('" + denngay + "','dd/MM/yyyy'),ngaybnngach)) -count(e.manv))/2";
            dk3 = " date_part('year',age(to_timestamp('" + denngay + "','dd/MM/yyyy'),ngaybnngach)) -count(e.manv)";
            dkngach = " d.loaingach in ('A0','A1','A2','A2.1','A3')";
            
            sql += " case when (case when " + dkngach + " then round(" + dk1 + ") else ";
            sql += " round(" + dk2 + ") end+bac)>baccuoi then baccuoi else case when " + dkngach;
            sql += " then round(" + dk1 + ") else round(" + dk2 + ") end+bac end as bac,0.0 as hs_lcmoi,";
            sql += " to_timestamp(Replace(to_char(ngaybnngach,'dd/mm')||'/'||to_char(case when (case when " + dkngach + " then round(" + dk1 + ") else ";
            sql += " round(" + dk2 + ") end+bac)>baccuoi then baccuoi-bac else case when " + dkngach;
            sql += " then round(" + dk1 + ")*3 else ";
            sql += " round(" + dk2 + ")*2 end end + date_part('year',ngaybnngach),'9999S'),'+',''),'dd/MM/yyyy') as ngaynang ";

            sql += " ,to_char(to_timestamp(Replace(to_char(ngaybnngach,'dd/mm')||'/'||to_char(case when (case when " + dkngach + " then round(" + dk1 + ") else ";
            sql += " round(" + dk2 + ") end+bac)>baccuoi then baccuoi-bac else case when " + dkngach;
            sql += " then round(" + dk1 + ")*3 else ";
            sql += " round(" + dk2 + ")*2 end end + date_part('year',ngaybnngach),'9999S'),'+',''),'dd/MM/yyyy'),'dd/MM/yyyy') as s_ngaynang ";
            sql += " ,a.manv,b.luonghd,c.sothutu as stt_bp,ct.stt as stt_dt,d.stt as stt_mn";
            sql += " from " + user + ".llnv a inner join " + user + ".hopdong b on a.manv=b.manv  ";
            sql += " inner join " + user + ".bophan c on b.madv =c.madv ";
            sql += " inner join " + user + ".dmcv cv on b.macv =cv.macv ";
            sql += " left join " + user + ".ctdaotao ct on ct.mactdt=a.nnghiep";
            sql += " left join " + user + ".bangcap bc on a.td_nnghiep=bc.mabangcap";
            sql += " inner join " + user + ".max_lan ml on b.manv=ml.manv";
            sql += " join " + user + ".mangach d on d.ma=b.mangach left join " + user + ".dmnhiemvu e on a.manv=e.manv and date_part('year',ngaybnngach)>=to_number(e.nam,'9999S')";
            sql += " inner join " + user + ".nhomngach nn on nn.manhom=d.nhomngach";
            sql += " where mangach<>'00.000' and to_timestamp(ngayhd,'dd/MM/yyyy')<= to_timestamp('" + denngay + "','dd/MM/yyyy') and ";
            sql += " (b.ngaynghi is null or to_timestamp(ngaynghi,'dd/MM/yyyy') > to_timestamp('" + denngay + "','dd/MM/yyyy')) and bac<baccuoi and d.loaingach<>'' ";
            sql += " and b.lan=ml.lan";
            sql += " group by a.ho,a.ten,a.phai,a.ngaysinh,a.namsinh,b.mangach,b.hs_lc,ngaybnngach,tenbp,d.loaingach,d.nhomngach,nn.tennhom ";
            sql += " ,b.hs_vk,b.bac,d.baccuoi,a.manv,b.madv,ct.tenvt,b.luonghd,b.lan,c.sothutu,ct.stt,d.stt,ct.tenctdt,bc.tenbang,b.macv,c.mabsoft";
            sql += " having(case when " + dkngach + " then " + dk3 + ">=3 else ";
            sql += dk3 + ">=2 end) and to_timestamp(Replace(to_char(case when (case when " + dkngach;
            sql += " then round(" + dk1 + ") else round(" + dk2 + ") end+bac)>baccuoi ";
            sql += " then baccuoi-bac else case when " + dkngach + "then round("+dk1+")*3 else ";
            sql += " round(" + dk2 + ")*2 end end +";
            sql += " date_part('year',ngaybnngach),'9999S')||to_char(ngaybnngach,'mm-dd'),'+','-'),'yyyy-mm-dd') ";
            sql += " between to_timestamp('" + tungay + "','dd/MM/yyyy') and to_timestamp('" + denngay + "','dd/MM/yyyy')";
            if (s_manhom.Trim() != "")
            {
                string s1 = g_manhom(s_manhom.Substring(0, s_manhom.Trim().Length - 1));
                sql += " and d.nhomngach in (" + s1.Substring(0, s1.Length - 1) + ")";
            }
            if (cbo_nhom.SelectedIndex == 0)
                sql += " and c.mabsoft in ('L','C','P','K')";
            if (cbo_nhom.SelectedIndex == 1)
                sql += " and c.mabsoft in ('D')";
            if (cbo_nhom.SelectedIndex == 2)
                sql += " and c.mabsoft in ('X')";
            sql += " order by c.sothutu,ct.stt,d.stt";
            sql1 = " select * from " + mDb.user + ".mangach order by stt";
           
            ds = mDb.get_data(sql,sql1);
            
            if (ds != null)
            {
                ds.WriteXml("..\\xml\\h_CB_CNVNL_quy.xml", XmlWriteMode.WriteSchema);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    decimal sothang;
                    stt ++;
                    DataRow[] r = ds.Tables[1].Select("ma='" + dr["mangach"].ToString() + "'");
                    if (r.Length > 0)
                    {
                        dr["stt"] = stt.ToString();
                        dr["hs_lcmoi"] = r[0]["b" + dr["bac"].ToString()];
                        
                    }
                }
                dgvDanhSach.DataSource = ds.Tables[0];

                cmbhoten.DisplayMember = "hoten";
                cmbhoten.ValueMember = "manv";
                cmbhoten.DataSource = ds.Tables[0];

                txttongso.Text = ds.Tables[0].Rows.Count.ToString();
            }
            return null;
        }

        private void cmbquy_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void cmbquy_SelectedIndexChanged(object sender, EventArgs e)
        {
            getdata();
        }

        private void txtnam_Validated(object sender, EventArgs e)
        {
            cmbquy_SelectedIndexChanged(sender, e);
        }

        private void txtnam_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((e.KeyChar < '0' || e.KeyChar > '9') && e.KeyChar != '\b')
                e.KeyChar = '\0';
        }

        public void getngay()
        {
            tungay = haison1.tungay;
            denngay = haison1.denngay;   
        }

        private void btnchon_Click(object sender, EventArgs e)
        {
            ReportName = "h_CB_CNVNL_quy.rpt";
            frmReport f = new frmReport(mDb, ds, ReportName,msg,title,user_dn);
            switch (checkxem.Checked)
            {
                case true:
                    f.Show();
                    if (checkupdate.Checked)
                        Update_bacluong(ds);
                    if (chk_uphd.Checked)
                    {
                        Update_bacluong_1(ds);
                    }
                    break;
                case false:
                    if (checkin.Checked)
                    {
                        f.PreviewReport();
                        f.butIn_Click(null, null);
                    }
                    if (checkupdate.Checked)
                        Update_bacluong(ds);
                    break;
            }
        }

        private void btnketthuc_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        // them nang bac luong cho tung nguoi
        private void Update_bacluong_1(DataSet dsbl)
        {
            if (DateTime.Now.Date >= Convert.ToDateTime(tungay))
            {
                string mmyy = DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().Substring(2, 2),
                    baccu = "", bacmoi = "";
                 string manv_n = txtmanv.Text.Trim();
                foreach (DataRow dr in dsbl.Tables[0].Rows)
                {
                    if (manv_n == dr["manv"].ToString())
                    {
                        DateTime n_nang = DateTime.Parse(dr["ngaynang"].ToString().Trim());
                        baccu = dr["b_dau"].ToString().Trim() + "  |  " + dr["hs_lc"].ToString().Trim();
                        bacmoi = dr["bac"].ToString().Trim() + "  |  " + dr["hs_lcmoi"].ToString().Trim();
                        mDb.update_bacluong(dr["manv"].ToString(), mmyy, dr["ngaybnngach"].ToString(), baccu, n_nang.ToString("dd/MM/yyyy"), bacmoi, dr["mangach"].ToString(), dr["mangach"].ToString(), DateTime.Now.Date.ToString("dd/MM/yyyy"), dr["madv"].ToString().Trim(), dr["macv"].ToString().Trim());

                        update_hs_luonghd(dr["manv"].ToString(), dr["hs_lcmoi"].ToString(),n_nang.ToString("dd/MM/yyyy"), dr["bac"].ToString(),decimal.Parse(dr["lan"].ToString()));
                    }
                }
            }
            else
            {
                MessageBox.Show(lan.Change_language_MessageText("Thời điểm nâng bậc lương không hợp lệ !"));
                
            }
        }
        public void Update_bacluong(DataSet dsbl)
        {
            if (DateTime.Now.Date >= Convert.ToDateTime(tungay))
            {
                string mmyy = DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().Substring(2, 2),
                    baccu = "", bacmoi = "";
                foreach (DataRow dr in dsbl.Tables[0].Rows)
                {
                    DateTime n_nang = DateTime.Parse(dr["ngaynang"].ToString().Trim());
                    baccu = dr["b_dau"].ToString().Trim() + "  |  " + dr["hs_lc"].ToString().Trim();
                    bacmoi = dr["bac"].ToString().Trim() + "  |  " + dr["hs_lcmoi"].ToString().Trim();
                    mDb.update_bacluong(dr["manv"].ToString(), mmyy, dr["ngaybnngach"].ToString(), baccu, n_nang.ToString("dd/MM/yyyy"), bacmoi, dr["mangach"].ToString(), dr["mangach"].ToString(), DateTime.Now.Date.ToString("dd/MM/yyyy"), dr["madv"].ToString().Trim(), dr["macv"].ToString().Trim());

                    update_hs_luonghd(dr["manv"].ToString(), dr["hs_lcmoi"].ToString(),n_nang.ToString("dd/MM/yyyy"), dr["bac"].ToString(),decimal.Parse(dr["lan"].ToString()));
                }
            }
            else
            {
                MessageBox.Show(lan.Change_language_MessageText("Thời điểm nâng bậc lương không hợp lệ !"));
                
            }
        }

        public bool update_hs_luonghd(string manv, string hs_lc, string ngay,string bac ,decimal lan)
        {
           return mDb.update_hs_luonghd( manv, hs_lc, ngay, bac , lan);
        }

        private void cmbhoten_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtmanv.Text = cmbhoten.SelectedValue.ToString();
        }

        private void checkxem_CheckedChanged(object sender, EventArgs e)
        {
            if (!checkupdate.Checked)
            {
                if (checkxem.Checked)
                    checkin.Checked = false;
                else
                    checkin.Checked = true;
            }
        }

        private void checkin_CheckedChanged(object sender, EventArgs e)
        {
            if (!checkupdate.Checked)
            {
                if (checkin.Checked)
                    checkxem.Checked = false;
                else
                    checkxem.Checked = true;
            }
        }

        private void chk_uphd_CheckedChanged(object sender, EventArgs e)
        {
            if (chk_uphd.Checked == true)
            {
                checkupdate.Checked = false;
                checkupdate.Enabled = false;
            }
            else
            {
                checkupdate.Enabled = true;
            }
        }

        private void checkupdate_CheckedChanged(object sender, EventArgs e)
        {
            if (checkupdate.Checked == true)
            {
                chk_uphd.Checked = false;
                chk_uphd.Enabled = false;
            }
            else
            {
                chk_uphd.Enabled = true;
            }
        }  

        private void haison1_MouseEnter(object sender, EventArgs e)
        {
            getdata();
        }

        private void haison1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
                SendKeys.Send("{Tab}");
        }

        private void haison1_Validated(object sender, EventArgs e)
        {
            getdata();
        }

        private void chkl_nhomngach_Validated(object sender, EventArgs e)
        {
            try
            {
                chkl_nhomngach.SetItemCheckState(chkl_nhomngach.SelectedIndex, CheckState.Checked);
                s_manhom = ""; s_tennhom = "";
                for (int i = 0; i < chkl_nhomngach.Items.Count; i++)
                {
                    if (chkl_nhomngach.GetItemChecked(i))
                    {
                        s_manhom += mDb.getrowbyid(ds_nhomn.Tables[0], "tennhom='" + chkl_nhomngach.Items[i].ToString() + "'")["manhom"].ToString() + ",";
                        s_tennhom += chkl_nhomngach.Items[i].ToString() + ",";
                    }
                }
                s_tennhom = s_tennhom.Trim().Substring(0, s_tennhom.Length - 1);
                txt_tieude.Text = s_tennhom;
            }
            catch { }
        }

	}
}
